<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'allnews.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript">
function checkID(){
	var select_option=document.getElementById("select_option").value;
	var input_select_option=document.getElementById("input_select_option").value;
	
	if(select_option==1){
		if(input_select_option<0){
			alert("输入值非法，请重新输入");
			return false;
		} else if(input_select_option>2147483647){
			alert("输入值非法，请重新输入");
			return false;
		}else if(isNaN(input_select_option)){
			alert("输入值非法，请重新输入");
			return false;
		}else{
			return true;
		}
	}
	
}

</script>
</head>
<body>
	<div>
		<a href="<%=basePath%>news/addNews.jsp">新建</a>
	</div>
<div style="margin-top:20px; margin-left: 80px;width: 600px;height: 40px;">
   <label style="font-weight: bold;color:red;">查询说明:</label><br/><font style="font-weight: bold;">(1)</font> 在进行编号查询时请您确认您输入的是<font style="font-weight: bold;">数字</font>
   而不是其他字符
   </div>
	<div style="margin-left:auto;margin-right:auto ; width: 660px;height: 40px;margin-top: 30px;">
				<form action="<%=basePath%>servlet/BackSearchServlet?type=news"
					method="post" onsubmit="return checkID()">
					<table>
						<tr>
							<td><label style="font-weight: bold;">关键字搜索</label> 
							<select id="select_option"
								name="search" style="height: 30px;">
									<option value="1">按编号搜索</option>
									<option value="2">按标题搜索</option>
									<option value="3">按时间搜索</option>
									<option value="4">按内容搜索</option>
							</select> 
							<input type="text" name="title" style="width:250px;height: 30px;"placeholder="请输入关键字" id="input_select_option" /> <input
								type="submit" value="搜索" id="btn" style="height: 30px;background:#3358FF;"  /></td>
						</tr>
					</table>
				</form>
			</div>
			<div style="margin-top: 20px;">
	<center>
		<table style="border: 1px solid #BCE2F3;">
			<tr
				style="text-align:center; height: 28px;border-bottom: 1px solid #64B8E4;background: #E4F2FB;">
				<td>编号</td>
				<td>标题</td>
				<td>时间</td>
				<td>作者</td>
				<td>来源</td>
				<td>责任编辑</td>
				<td>相关操作</td>
			</tr>
			<c:forEach items="${nlist.list}" var="n">
				<tr style="text-align:center;">
					<td>
					<li style="list-style: none;"><a style="text-decoration: none;" title="${n.id}"
						href="<%=basePath%>servlet/NewsServlet?m=DetailsNews&id=${n.id}">${n.id }</a>
				
				</li>	</td>
					<td>
					<li style="list-style: none;"><a style="text-decoration: none;" title="${n.title}"
						href="<%=basePath%>servlet/NewsServlet?m=DetailsNews&id=${n.id}">${n.title}</a>
</li>
					</td>
					<td><li style="list-style: none;">${n.time}</li></td>
					<td><li style="list-style: none;">${n.author }</li></td>
					<td><li style="list-style: none;">${n.source }</li></td>
					<td><li style="list-style: none;">${n.editor }</li></td>
					<td><li style="list-style: none;"><a style="text-decoration: none;"
						href="<%=basePath%>servlet/NewsServlet?m=DelNews&id=${n.id}">删除</a>

						<a style="text-decoration: none;"
						href="<%=basePath%>servlet/NewsServlet?m=uploadPic&id=${n.id}">添加照片</a>
					</li>
					</td>
				</tr>
			</c:forEach>
		</table>
		<div style="margin-top: 20px;">
			<font color="#0000EE">共${nlist.maxPage}页</font>&nbsp;&nbsp; <a style="text-decoration: none;"
				href="<%=basePath%>servlet/NewsServlet?m=AllNews">第一页</a> <a style="text-decoration: none;"
				href="<%=basePath%>servlet/NewsServlet?m=AllNews&method=pre">上一页</a>
			<c:forEach begin="1" end="${nlist.maxPage}" step="1" var="i">
	&nbsp;&nbsp;<a style="text-decoration: none;"
					href="<%=basePath%>servlet/NewsServlet?m=AllNews&method=index&ind=${i}">${i }</a>
			</c:forEach>
			&nbsp;&nbsp; <a style="text-decoration: none;"
				href="<%=basePath%>servlet/NewsServlet?m=AllNews&method=next">下一页</a>
			<a style="text-decoration: none;"href="<%=basePath%>servlet/NewsServlet?m=AllNews&method=last">最后一页</a>
		</div>
	</center>
	</div>
</body>
</html>
